image: appsec4u/worker:keyid

variables:
  ENG: 4

stages:
  - build
  - test
  - prelive
  - prod
  
before_script:
  - export DOJO_APIKEY=$DOJO_APIKEY
  - export DOJO_HOST=$DOJO_HOST

build:
  stage: build
  image: python:3.6
  before_script:
   - pip3 install --upgrade virtualenv
  script:
   - virtualenv env                       # Create a virtual environment for the python application
   - source env/bin/activate              # Activate the virtual environment
   - pip install -r requirements.txt      # Install the required third party packages as defined in requirements.txt
   - python manage.py check               # Run checks to ensure the application is working fine

test:
  stage: test
  image: python:3.6
  before_script:
   - pip3 install --upgrade virtualenv
  script:
   - virtualenv env
   - source env/bin/activate
   - pip install -r requirements.txt
   - python manage.py test taskManager

sast_semgrep:
  stage: build
  script:
    scansuite semgrep_local $ENG
  allow_failure: true

sast_codeql:
  stage: build
  script:
    scansuite codeql $ENG python
  allow_failure: true

sast_python:
  stage: build
  script:
    scansuite python $ENG
  allow_failure: true

secrets_gitleaks:
  stage: build
  script:
    - scansuite gitleaks $ENG
  allow_failure: true

secrets_trufflehog:
  stage: build
  script:
    - scansuite trufflehog $ENG
  allow_failure: true

iacs_kics:
  stage: test
  script:
    - scansuite iacs_kics $ENG
  allow_failure: true

dependency_check_trivy:
  stage: test
  script:
    - scansuite dep_trivy $ENG
  allow_failure: true

prelife:
  stage: prelive
  script:
    - id

production:
  stage: prod
  script:
    - id